package _TUN.Archivage;

import himalaya.Archivage;
import himalaya.Commande;
import himalaya.Ressource;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;

import tests.Tests;

public class T_Archivage_N1 {
	public static void main (String[] args) throws FileNotFoundException, IOException, ClassNotFoundException{

	      Tests.Begin("personne.Archivage", "1.0.0");

	         Tests.Design("Controle du fonctionnement de la serialisation", 3); {

			Tests.Case("serialierObjet"); {
				LinkedList<Ressource> listeRessources = new LinkedList<Ressource>();
            	listeRessources.add(Ressource.sel);
            	listeRessources.add(Ressource.or);
            	listeRessources.add(Ressource.jade);
            	
            	Commande c1 = new Commande(1,30,listeRessources);
            	Archivage.serialiserObjet(c1, "FichierDeMonChoix.out");
            	
			}
			
			Tests.Case("deserialierObjet"); {
				LinkedList<Ressource> listeRessources = new LinkedList<Ressource>();
            	listeRessources.add(Ressource.sel);
            	listeRessources.add(Ressource.or);
            	listeRessources.add(Ressource.jade);
            	
            	Commande c1 = new Commande(1,30,listeRessources);           	
            	Archivage.serialiserObjet(c1, "test_deserialisation.out");
            	
            	Commande commandeRecuperee = (Commande) Archivage.deserialiserFichier("test_deserialisation.out");
            	
            	Tests.Unit(c1.toString(), commandeRecuperee.toString());
            	
			}
	      }

	   Tests.End();
	   }
}
